import axios from 'axios'
import { getToken } from './token'
const request = axios.create({
  baseURL: 'http://127.0.0.1:2303',
  timeout: 10000,
  headers: {
    'Content-Type': "application/json; charset=utf-8"
}
})
request.interceptors.request.use(config => {
  config.headers['Authorization'] ='Bearer '+getToken()
  return config
})
request.interceptors.response.use(function (response) {

  return response.data
}, function (error) {

  return Promise.reject(error);
});
export default request